#include <iostream>

struct ListNode;

ListNode* bulidRandomList();
void printList(ListNode* head);
void destoryList(ListNode *head);
ListNode* divideList(ListNode* head);
ListNode *reverseList(ListNode *head);
void reorderList(ListNode *head);


void test_reverseList()
{
    std::cout << "testing reverse list"<<std::endl;
    ListNode *head = bulidRandomList();

    printList(head);
    printList(reverseList(head));

    destoryList(head);
}


void test_divideList()
{
    std::cout << "testing divide list"<<std::endl;
    ListNode *head = bulidRandomList();
    std::cout << "before divide:"<<std::endl;
    printList(head);
    ListNode *newList = divideList(head);
    std::cout << "after divide:"<<std::endl;
    printList(head), printList(newList);
    destoryList(newList);
    destoryList(head);

}

void test_reorderList()
{
    ListNode *head = bulidRandomList();
    printList(head);
    std::cout << "call reorder:\n";
    reorderList(head);
    printList(head);

}


int main(int argc, char const *argv[])
{
    test_reorderList();
    auto a = 0;
    return 0;
}

